package ace.module.account.sdk.core.feign.impl;

import ace.cmp.core.model.PageResultDto;
import ace.cmp.core.model.R;
import ace.cmp.openfeign.security.oauth2.core.config.FeignInternalServerOauth2SecurityConfig;
import ace.module.account.api.model.dto.IamAccountPassportDto;
import ace.module.account.api.model.input.passport.IamAccountPassportSearchOutInput;
import ace.module.account.sdk.core.constant.SdkConstant;
import ace.module.account.sdk.core.feign.IamAccountPassportFeignApi;
import ace.module.common.api.annotation.ApiRemoteProxyPriority;
import ace.module.common.api.model.input.PageInput;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Caspar
 */
@FeignClient(
    name = "${spring.cloud.openfeign.client.config.iamAccountPassportFeign.name:"
        + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "iamAccountPassportFeign",
    path = IamAccountPassportFeign.PATH,
    configuration = FeignInternalServerOauth2SecurityConfig.class,
    primary = false
)
@ApiRemoteProxyPriority
public interface IamAccountPassportFeign extends IamAccountPassportFeignApi {

  String PATH = "${spring.cloud.openfeign.client.config.iamAccountPassportFeign.path:/account/iam-account-passport/rpc}";

  /**
   * 获取通行证
   *
   * @return
   */
  @GetMapping("/getByAppBizTypeIdAndPassport123AndPassportType")
  R<IamAccountPassportDto> getByIamAppIdAndPassport123AndPassportType(
      @Valid @NotNull @RequestParam("appBizTypeId") Long appBizTypeId,
      @Valid @NotEmpty @RequestParam("passport") String passport,
      @Valid @NotEmpty @RequestParam("passport2") String passport2,
      @Valid @NotEmpty @RequestParam("passport3") String passport3,
      @Valid @NotEmpty @RequestParam("passportType") Integer passportType);

  @PostMapping("/search")
  R<PageResultDto<IamAccountPassportDto>> search(
      @Valid @NotNull @RequestBody PageInput<IamAccountPassportSearchOutInput> input);
}
